Repository navigation
fix(layer): ship the native addon versions dd-trace declares - #857
Merged
Merged
Conversation
The layer is installed with --ignore-optional, which drops dd-trace's
optional native addons (@datadog/pprof, @datadog/native-appsec). The build
re-added them at our own devDependency pins, which drift from the versions
dd-trace calls into:
- dd-trace >= 5.128.0 / 6.17.0 defaults
DD_PROFILING_EXPERIMENTAL_OOM_HEAP_LIMIT_EXTENSION_SIZE to "auto", which
only @datadog/pprof >= 5.19.0 accepts. Against our 5.18.1 pin the
profiler fails to start ("Heap limit extension size must be a uint32")
and no profiles are sent. Released layers still ship dd-trace 6.15.0 and
are not affected yet; a layer built against dd-trace master is.
- @datadog/native-appsec "*" resolves to 11.0.1 from the lockfile, while
dd-trace 6.15.0 declares 11.0.2.
Take both from the installed dd-trace's optionalDependencies instead, and
do the same in the local integration test layer fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
Targeted manifest and error-path checks support selecting native-addon versions from the bundled dd-trace manifest. Full layer builds remain unverified because dependencies were absent.
🤖 Bits Code Review · Commit 4efdcfd
purple4reina
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Makes the layer ship
@datadog/pprofand@datadog/native-appsecat the exact versions declared by the dd-trace it bundles, instead of at datadog-lambda-js's own devDependency pins.scripts/move_ddtrace_dependency.jsnow takes the installed dd-tracepackage.json. It reads the dd-trace version and the two native addon versions (from dd-trace'soptionalDependencies) from that file. The build fails with a clear error if dd-trace stops declaring either addon, instead of silently falling back to a stale pin.Dockerfilepassesnode_modules/dd-trace/package.jsonto the script.integration_tests_local/prepare-layer.js(and its README) does the same, so the local layer fixture keeps matching the release layer.Motivation
profiling would be broken if we release a layer now.
Why it breaks?
This pin has broken in both directions before. It started as
"*", which drifted ahead of dd-trace, was then pinned to5.14.4(#783), and has now fallen behind dd-trace. Taking the versions from dd-trace removes the second source of truth.Testing Guidelines
The script's output for each dd-trace manifest:
@datadog/pprof@datadog/native-appsec*→ 11.0.1*→ 11.0.1*→ 11.0.1Error paths: a missing dd-trace argument, and a dd-trace manifest that doesn't declare
@datadog/pprof, both fail with a descriptive error.prepare-layer.jsagainst the installed tree writes dd-trace 6.15.0, pprof 5.18.1 and native-appsec 11.0.2 todeps.package.json.The layer Docker build for every Node version runs in this PR's CI ("Build Layers for System Tests" and the GitLab layer build and size check).
End-to-end on Lambda
nodejs26.x(serverless-e2e-teststest_profiling_usage, staging org): I built this branch's layer with dd-trace bumped to 6.22.0, which defaults to"auto"and declares pprof 5.20.0. The build pulled in pprof 5.20.0 and native-appsec 11.0.3. With no env overrides, across 22 invocations:uint32errors;intake.profile.datad0g.com;datadog.profiling.agentreported, andtest_profiling_usage[node26-profiling]passed.The same test against a layer bundling pprof 5.18.1 (built against dd-trace master) produced no profiles.
Additional Notes
@datadog/pprofand@datadog/native-appsecdevDependencies stay as they are for local development and unit tests. They no longer decide what ships in the layer.Dockerfile(for example, ones that copy a dd-trace checkout overnode_modules) aren't covered by this change.NativeSpaceProfiler.startso it disables only OOM monitoring, not all profiling.Types of Changes
Check all that apply
🤖 Generated with Claude Code